package com.easyj.admin.db.model;

import java.io.Serializable;
import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.easyj.base.cache.SysCacheUtil;
import com.easyj.base.enums.Level2ApplyStatusEnum;


/**
 *   @title 教师发表
 *   @remark 
 *   @table s_publish
 *   @primaryKey id
 *   @enablePage true
 */
public class Publish implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     *   @title 
     *   @remark 
     *   @column id
     *   @dataType BIGINT UNSIGNED
     *   @length 20
     *   @scale 0
     *   @nullable false
     *   @jdbcType BIGINT
     */
    private Long id;

    /**
     *   @title 成果名称
     *   @remark 
     *   @column name
     *   @dataType VARCHAR
     *   @length 250
     *   @scale 0
     *   @nullable false
     *   @jdbcType VARCHAR
     */
    @NotBlank
    private String name;

    /**
     *   @title 成果形式
     *   @remark 
     *   @column type
     *   @dataType VARCHAR
     *   @length 40
     *   @scale 0
     *   @nullable false
     *   @jdbcType VARCHAR
     */
    private String type;

    /**
     *   @title 成果描述
     *   @remark 
     *   @column content
     *   @dataType VARCHAR
     *   @length 500
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    private String content;

    /**
     *   @title 承担角色
     *   @remark 
     *   @column role
     *   @dataType VARCHAR
     *   @length 120
     *   @scale 0
     *   @nullable false
     *   @jdbcType VARCHAR
     */
    private String role;

    /**
     *   @title 第一作者
     *   @remark 
     *   @column first_author
     *   @dataType VARCHAR
     *   @length 100
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    private String firstAuthor;

    /**
     *   @title 第一作者所属单位
     *   @remark 
     *   @column firs_author_org
     *   @dataType VARCHAR
     *   @length 200
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    private String firsAuthorOrg;

    /**
     *   @title 刊物名称
     *   @remark 
     *   @column publish_name
     *   @dataType VARCHAR
     *   @length 150
     *   @scale 0
     *   @nullable false
     *   @jdbcType VARCHAR
     */
    @NotBlank
    private String publishName;

    /**
     *   @title 刊物级别
     *   @remark 
     *   @column publish_level
     *   @dataType VARCHAR
     *   @length 30
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    private String publishLevel;

    /**
     *   @title 期刊号/书号
     *   @remark 
     *   @column publish_no
     *   @dataType VARCHAR
     *   @length 100
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    private String publishNo;

    /**
     *   @title 出版单位
     *   @remark 
     *   @column press
     *   @dataType VARCHAR
     *   @length 150
     *   @scale 0
     *   @nullable false
     *   @jdbcType VARCHAR
     */
    @NotBlank
    private String press;

    /**
     *   @title 发表日期
     *   @remark 
     *   @column press_date
     *   @dataType DATE
     *   @length 10
     *   @scale 0
     *   @nullable false
     *   @jdbcType DATE
     */
    @NotNull
    private Date pressDate;

    /**
     *   @title 附件
     *   @remark 
     *   @column append_files
     *   @dataType JSON
     *   @length 0
     *   @scale 0
     *   @nullable true
     *   @jdbcType CHAR
     */
    private String appendFiles;

    /**
     *   @title 申请人
     *   @remark 
     *   @column applicant_id
     *   @dataType BIGINT
     *   @length 19
     *   @scale 0
     *   @nullable false
     *   @jdbcType BIGINT
     */
    private Long applicantId;

    /**
     *   @title 申请人所属部门
     *   @remark 冗余
     *   @column dept_id
     *   @dataType BIGINT
     *   @length 19
     *   @scale 0
     *   @nullable false
     *   @jdbcType BIGINT
     */
    private Long deptId;

    /**
     *   @title 
     *   @remark 
     *   @column apply_name
     *   @dataType VARCHAR
     *   @length 250
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    private String applyName;

    /**
     *   @title 申请日期
     *   @remark 
     *   @column apply_time
     *   @dataType DATETIME
     *   @length 19
     *   @scale 0
     *   @nullable true
     *   @jdbcType TIMESTAMP
     */
    private Date applyTime;

    /**
     *   @title 审批人
     *   @remark 
     *   @column approve_id
     *   @dataType BIGINT
     *   @length 19
     *   @scale 0
     *   @nullable true
     *   @jdbcType BIGINT
     */
    private Long approveId;

    /**
     *   @title 审批日期
     *   @remark 
     *   @column approve_time
     *   @dataType DATETIME
     *   @length 19
     *   @scale 0
     *   @nullable true
     *   @jdbcType TIMESTAMP
     */
    private Date approveTime;

    /**
     *   @title 审批意见
     *   @remark 
     *   @column approve_comment
     *   @dataType VARCHAR
     *   @length 300
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    private String approveComment;

    /**
     *   @title 
     *   @remark 
     *   @column status
     *   @dataType INT
     *   @length 10
     *   @scale 0
     *   @nullable false
     *   @jdbcType INTEGER
     */
    private Integer status;
    
    /**
     * 
     * @return 状态
     */
    public String getStatusName() {
    	return Level2ApplyStatusEnum.getText(status);
    }
    
    /**
     * 
     * @return 成果形式
     */
    public String getTypeName() {
      return SysCacheUtil.getDirtionaryItemName("PUBLISHTYPE", type);
    }
    
    /**
     * 
     * @return 刊物级别
     */
    public String getPublishLevelName() {
      return SysCacheUtil.getDirtionaryItemName("HWJB", publishLevel);
    }
    /**
     * 
     * @return 申请人
     */
    public String getApplicantName(){
    	return SysCacheUtil.getOperatorName(applicantId);
    }
    
    /**
     * 
     * @return 所属部门
     */
    public String getDeptName(){
    	return SysCacheUtil.getDepartmentName(deptId);
    }
    
    /**
     * 
     * @return 审批人
     */
    public String getApproveName(){
    	return SysCacheUtil.getOperatorName(approveId);
    }
    
    /**
     *   @title 
     *   @remark 
     *   @column audit_comment
     *   @dataType VARCHAR
     *   @length 300
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    private String auditComment;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getFirstAuthor() {
        return firstAuthor;
    }

    public void setFirstAuthor(String firstAuthor) {
        this.firstAuthor = firstAuthor;
    }

    public String getFirsAuthorOrg() {
        return firsAuthorOrg;
    }

    public void setFirsAuthorOrg(String firsAuthorOrg) {
        this.firsAuthorOrg = firsAuthorOrg;
    }

    public String getPublishName() {
        return publishName;
    }

    public void setPublishName(String publishName) {
        this.publishName = publishName;
    }

    public String getPublishLevel() {
        return publishLevel;
    }

    public void setPublishLevel(String publishLevel) {
        this.publishLevel = publishLevel;
    }

    public String getPublishNo() {
        return publishNo;
    }

    public void setPublishNo(String publishNo) {
        this.publishNo = publishNo;
    }

    public String getPress() {
        return press;
    }

    public void setPress(String press) {
        this.press = press;
    }

    public Date getPressDate() {
        return pressDate;
    }

    public void setPressDate(Date pressDate) {
        this.pressDate = pressDate;
    }

    public String getAppendFiles() {
        return appendFiles;
    }

    public void setAppendFiles(String appendFiles) {
        this.appendFiles = appendFiles;
    }

    public Long getApplicantId() {
        return applicantId;
    }

    public void setApplicantId(Long applicantId) {
        this.applicantId = applicantId;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public String getApplyName() {
        return applyName;
    }

    public void setApplyName(String applyName) {
        this.applyName = applyName;
    }

    public Date getApplyTime() {
        return applyTime;
    }

    public void setApplyTime(Date applyTime) {
        this.applyTime = applyTime;
    }

    public Long getApproveId() {
        return approveId;
    }

    public void setApproveId(Long approveId) {
        this.approveId = approveId;
    }

    public Date getApproveTime() {
        return approveTime;
    }

    public void setApproveTime(Date approveTime) {
        this.approveTime = approveTime;
    }

    public String getApproveComment() {
        return approveComment;
    }

    public void setApproveComment(String approveComment) {
        this.approveComment = approveComment;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getAuditComment() {
        return auditComment;
    }

    public void setAuditComment(String auditComment) {
        this.auditComment = auditComment;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Publish other = (Publish) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", type=").append(type);
        sb.append(", content=").append(content);
        sb.append(", role=").append(role);
        sb.append(", firstAuthor=").append(firstAuthor);
        sb.append(", firsAuthorOrg=").append(firsAuthorOrg);
        sb.append(", publishName=").append(publishName);
        sb.append(", publishLevel=").append(publishLevel);
        sb.append(", publishNo=").append(publishNo);
        sb.append(", press=").append(press);
        sb.append(", pressDate=").append(pressDate);
        sb.append(", appendFiles=").append(appendFiles);
        sb.append(", applicantId=").append(applicantId);
        sb.append(", deptId=").append(deptId);
        sb.append(", applyName=").append(applyName);
        sb.append(", applyTime=").append(applyTime);
        sb.append(", approveId=").append(approveId);
        sb.append(", approveTime=").append(approveTime);
        sb.append(", approveComment=").append(approveComment);
        sb.append(", status=").append(status);
        sb.append(", auditComment=").append(auditComment);
        sb.append("]");
        return sb.toString();
    }
}